input of while loop to come from output of `command`
Posted
by Felipe Alvarez
on Stack Overflow
See other posts from Stack Overflow
or by Felipe Alvarez
Published on 2010-06-06T05:32:46Z
Indexed on
2010/06/06
5:42 UTC
Read the original article
Hit count: 282
#I used to have this, but I don't want to write to the disk
#
pcap="somefile.pcap"
tcpdump -n -r $pcap > all.txt
while read line; do
ARRAY[$c]="$line"
c=$((c+1))
done < all.txt
The following fails to work.
# I would prefer something like...
#
pcap="somefile.pcap"
while read line; do
ARRAY[$c]="$line"
c=$((c+1))
done < $( tcpdump -n -r "$pcap" )
Too few results on Google (doesn't understand what I want to find :( ). I'd like to keep it Bourne-compatible (/bin/sh), but it doesn't have to be.
© Stack Overflow or respective owner